package com.joysuch.wwyt.core.repository;

import com.joysuch.wwyt.core.entity.BaseEvaluationIndicatorsContent;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;

import java.util.List;

public interface BaseEvaluationIndicatorsContentDao extends JpaRepository<BaseEvaluationIndicatorsContent, Long>, QuerydslPredicateExecutor<BaseEvaluationIndicatorsContent> {

    @Query(value = "SELECT ID FROM `wwyt_base_evaluation_indicators_content` WHERE CODE =?1 and EI_ID=?2", nativeQuery = true)
    Long findByCodeAndEid(String code, Long id);

    List<BaseEvaluationIndicatorsContent> findByEiId(Long id);

    public Page<BaseEvaluationIndicatorsContent> findAll(Specification<BaseEvaluationIndicatorsContent> spec, Pageable pageable);


}
